package aom.ju.ss.mode

import aom.ju.ss.utils.BigDecimalUtils
import aom.ju.ss.utils.LogUtils

data class HomeCatInfo(
    val code: Int,
    val count: Int,
    val `data`: HomeCatInfoData,
    val error_type: Int,
    val msg: String,
)

data class HomeCatInfoData(
    val cut_coupon_num: Int,
    val cut_level: Int,
    val cut_order_list: List<HomeCatInfoItem>?,
    val headimgurl: String,
    val nickname: String
) {
    var cut_leveltv: String? = ""
        get() {
            when (cut_level.toString()) {
                "0" -> {
                    field = "不是砍爷"
                }
                "1" -> {
                    field = "一星砍爷"
                }
                "2" -> {
                    field = "二星砍爷"
                }
                "3" -> {
                    field = "三星砍爷"
                }
                "4" -> {
                    field = "四星砍爷"
                }
                "5" -> {
                    field = "五星砍爷"
                }
                "6" -> {
                    field = "六星砍爷"
                }
                "7" -> {
                    field = "七星砍爷"
                }
                else -> {
                    field = cut_level.toString() + "星砍爷"
                }
            }
            return field
        }
}

data class HomeCatInfoItem(
    val goods_image: String,
    val goods_name: String,
    val id: String,
    val is_help: String
) {


    var cut_help_num: Int? = 0
        get() {
            if (field == null) {
                field = 0
            }
            return field
        }
    var cut_people_total: Int? = 0
        get() {
            if (field == null) {
                field = 0
            }
            return field
        }


    var is_helpbai: String = ""
        get() {
            if (cut_help_num != 0 && cut_people_total != 0) {
                field =
                    BigDecimalUtils.div2(
                        cut_people_total.toString(),
                        cut_help_num.toString(),
                        2)


            } else {
                field = "0"
            }

            return field
        }
}